import request from '../request'
export function getArticles (queryOptions, page, pageSize) {
  const data = { queryOptions, page, pageSize }
  return request({
    url: '/api/article/articles',
    method: 'post',
    data
  })
}

export function getArticleDetail (id) {
  const data = { id }
  return request({
    url: '/api/article/detail',
    method: 'get',
    data
  })
}

export function publishArticle (article) {
  return request({
    url: '/api/article/publish',
    method: 'post',
    data: article
  })
}
export function viewArticle (id) {
  return request({
    url: `/api/article/view`,
    method: 'post',
    data: { id }
  })
}

export function getHotArticles () {
  return request({
    url: '/api/article/hot',
    method: 'get'
  })
}

export function getNewArticles () {
  return request({
    url: '/api/article/new',
    method: 'get'
  })
}
